from project.models import Project, Participate, ProjectRole


def list_projects(user):
    projects = Project.objects.filter(id__in=ProjectRole.objects.filter(id__in=Participate.objects.filter(uid=user).values('rid')).values('pid'))
    return projects


def all_projects():
    projects = Project.objects.filter()
    return projects
